package enums;

import java.util.HashMap;
import java.util.Map;

/**
 * Provides all stati a row of data in the database can have.
 */
public enum Status {
	
	ACTIVE(1), INACTIVE(0), TOCALCULATE(2), ISADMIN(99), PAID(3), 
	/**
	 * This status is set for a product if it is the replacement of an active Product.
	 * <p>
	 * It will become active if the stock of the other product is 0.
	 */
	WAIT(4);
	
	
	private final int statusInt;
	
	/**
	 * Map of all existing Messages
	 */
	private static final Map<Integer, Status> intToStatus = new HashMap<>();

	static {
		for (Status f : Status.values()) {
			intToStatus.put(f.toInt(), f);
		}
	}

	private Status(int statusInt) {
		this.statusInt = statusInt;
	}

	public Integer toInt() {
		return statusInt;
	}

	public static Status fromInt(int i){
		return Status.intToStatus.get(i);
	}
}
